import { request } from '@umijs/max';
import api from '@/services/api';

export async function routeList(params) {
  return request(api.route_list, {
    method: 'GET',
    params,
  });
}

export async function routeDetail(params) {
  return request(api.route_detail, {
    method: 'GET',
    params,
  });
}

export async function routeCreate(data) {
  return request(api.route_create, {
    method: 'POST',
    data,
    headers: {
      'Content-Type': 'multipart/form-data',
    },
  });
}

export async function routeUpdate(data) {
  return request(api.route_update, {
    method: 'PUT',
    data,
  });
}

export async function routePointsUpdate(data) {
  return request(api.route_points_update, {
    method: 'PUT',
    data,
  });
}

export async function routeDelete(params) {
  return request(api.route_delete, {
    method: 'DELETE',
    params,
  });
}